package demo10;

import java.lang.invoke.CallSite;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * 首先判断同时是实体类
 *
 * **/
public class StoudentTest {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student student = new Student();
        student.setId(1);
        student.setName("张三");
        list.add(student);


        Student student2 = new Student();
        student2.setId(2);
        student2.setName("李四");
        list.add(student2);
        System.out.println(list);


        for (int i = 0; i < list.size(); i++) {

            Student s = list.get(i);
            if (s.getName().equals("张三")){
                s.setName("张三丰");
            }
        }
        System.out.println(list);


        for (int i = 0; i < list.size(); i++) {
            Student s1 = list.get(i);
            if (s1.getName().equals("李四")){
             list.remove(i);
            }
        }
        System.out.println(list);
    }
}
